package com.atguigu.spzx.manager.service.impl;

import com.atguigu.spzx.manager.mapper.SysMenuRoleMapper;
import com.atguigu.spzx.manager.service.SysMenuRoleService;
import com.atguigu.spzx.model.dto.system.AssginMenuDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @ClassName: SysMenuRoleServiceImpl
 * @Package: com.atguigu.spzx.manager.service.impl
 * @Description 保存角色分配的菜单
 * @Author 孤妤
 * @Date: 2023/12/6 16:29
 */
@Service
@Transactional
public class SysMenuRoleServiceImpl implements SysMenuRoleService {
    @Autowired
    private SysMenuRoleMapper sysMenuRoleMapper;
    @Override
    public void addSysMenuRole(AssginMenuDto assginMenuDto) {
        sysMenuRoleMapper.deleteSysMenuRoleById(assginMenuDto.getRoleId());
        if (assginMenuDto.getMenuIdList().isEmpty()){
            return;
        }
        sysMenuRoleMapper.insertSysMenuRole(assginMenuDto);
    }
}
